import { BrowserWindow} from 'electron';
let controlWindow

const create= async () => {
  controlWindow = new BrowserWindow({
    width: 1024,
    height: 728,
    webPreferences: {
      nodeIntegration: true,
    },
  });

  controlWindow.loadURL(`file://${__dirname}/../../renderer/pages/control.html`);

  // controlWindow.loadURL(`http://www.baidu.com`);

  // @TODO: Use 'ready-to-show' event
  //        https://github.com/electron/electron/blob/master/docs/api/browser-window.md#using-ready-to-show-event
  controlWindow.on('closed', () => {
    controlWindow = null;
  });
};

module.exports={create}
